package com.xinongbest.sqlSession;

import com.xinongbest.config.XMLConfigBuilder;
import com.xinongbest.pojo.Configuration;
import org.dom4j.DocumentException;

import java.beans.PropertyVetoException;
import java.io.InputStream;

public class SqlSessionBuilder {
    public SqlSessionFactory build(InputStream input) throws DocumentException, PropertyVetoException {
        XMLConfigBuilder xmlConfigBuilder = new XMLConfigBuilder();
        Configuration config = xmlConfigBuilder.parseConfig(input);
        SqlSessionFactory sqlSessionFactory = new DefaultSqlSessionFactory(config);
        return sqlSessionFactory;
    }
}
